package two_xia.ex1;

//乱导包，idea
//import java.awt.Shape;

/**
 *
 */
public class ShapeFactory {
    public ShapeFactory() {
    }

    public static Shape createShape(String type) throws UnsupportedShapeException {
        if ("c".equals(type))
            return new Circle();
        if ("r".equals(type))
            return new Rectangle();
        if ("t".equals(type))
            return new Triangle();
        throw new UnsupportedShapeException("输入不存在!");
    }

}